package com.cskaoyan.wx.controller;

import com.cskaoyan.service.GoodsManagementService;
import com.cskaoyan.vo.BaseRespVo;
import com.cskaoyan.vo.StorageVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

/**
 * @author LiaoLong
 * @date 2021-05-13 15:26
 */
@RestController
@RequestMapping("wx/storage")
public class WxStorageController {

    @Autowired
    private GoodsManagementService goodsManagementService;

    @Value("${file.wxPath}")
    private String wxPath;

    @PostMapping("upload")
    public BaseRespVo upload(MultipartFile file){
        StorageVO storageVO = goodsManagementService.fileupload(file, wxPath);
        return BaseRespVo.ok(storageVO);
    }
}
